

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>pymatgen.analysis.ferroelectricity package &mdash; pymatgen 2025.6.14 documentation</title>
      <link rel="stylesheet" type="text/css" href="assets/pygments.css?v=03e43079" />
      <link rel="stylesheet" type="text/css" href="assets/css/theme.css?v=e59714d7" />
      <link rel="stylesheet" type="text/css" href="assets/css/custom.css" />

  
    <link rel="canonical" href="https://pymatgen.orgpymatgen.analysis.ferroelectricity.html"/>
      <script src="assets/jquery.js?v=5d32c60e"></script>
      <script src="assets/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
      <script src="assets/documentation_options.js?v=03bec786"></script>
      <script src="assets/doctools.js?v=9bcbadda"></script>
      <script src="assets/sphinx_highlight.js?v=dc90522c"></script>
    <script src="assets/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: linear-gradient(0deg, rgba(23,63,162,1) 0%, rgba(0,70,192,1) 100%)" >

          
          
          <a href="index.html">
            
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">pymatgen.analysis.ferroelectricity package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pymatgen.analysis.ferroelectricity.polarization">pymatgen.analysis.ferroelectricity.polarization module</a><ul>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend"><code class="docutils literal notranslate"><span class="pre">EnergyTrend</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.endpoints_minima"><code class="docutils literal notranslate"><span class="pre">EnergyTrend.endpoints_minima()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.max_spline_jump"><code class="docutils literal notranslate"><span class="pre">EnergyTrend.max_spline_jump()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.smoothness"><code class="docutils literal notranslate"><span class="pre">EnergyTrend.smoothness()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.spline"><code class="docutils literal notranslate"><span class="pre">EnergyTrend.spline()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization"><code class="docutils literal notranslate"><span class="pre">Polarization</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.from_outcars_and_structures"><code class="docutils literal notranslate"><span class="pre">Polarization.from_outcars_and_structures()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_lattice_quanta"><code class="docutils literal notranslate"><span class="pre">Polarization.get_lattice_quanta()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_pelecs_and_pions"><code class="docutils literal notranslate"><span class="pre">Polarization.get_pelecs_and_pions()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_polarization_change"><code class="docutils literal notranslate"><span class="pre">Polarization.get_polarization_change()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_polarization_change_norm"><code class="docutils literal notranslate"><span class="pre">Polarization.get_polarization_change_norm()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_same_branch_polarization_data"><code class="docutils literal notranslate"><span class="pre">Polarization.get_same_branch_polarization_data()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.max_spline_jumps"><code class="docutils literal notranslate"><span class="pre">Polarization.max_spline_jumps()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.same_branch_splines"><code class="docutils literal notranslate"><span class="pre">Polarization.same_branch_splines()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.smoothness"><code class="docutils literal notranslate"><span class="pre">Polarization.smoothness()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.calc_ionic"><code class="docutils literal notranslate"><span class="pre">calc_ionic()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.get_nearest_site"><code class="docutils literal notranslate"><span class="pre">get_nearest_site()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.get_total_ionic_dipole"><code class="docutils literal notranslate"><span class="pre">get_total_ionic_dipole()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.analysis.ferroelectricity.polarization.zval_dict_from_potcar"><code class="docutils literal notranslate"><span class="pre">zval_dict_from_potcar()</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu"  style="background: linear-gradient(0deg, rgba(23,63,162,1) 0%, rgba(0,70,192,1) 100%)" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">pymatgen</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content style-external-links">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">pymatgen.analysis.ferroelectricity package</li>
      <li class="wy-breadcrumbs-aside">
              <a href="https://github.com/materialsproject/pymatgen/blob/master/docs_rst/pymatgen.analysis.ferroelectricity.rst" class="fa fa-github"> Edit on GitHub</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="module-pymatgen.analysis.ferroelectricity">
<span id="pymatgen-analysis-ferroelectricity-package"></span><h1>pymatgen.analysis.ferroelectricity package<a class="headerlink" href="#module-pymatgen.analysis.ferroelectricity" title="Link to this heading"></a></h1>
<p>Package for analyzing ferroelectricity.</p>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Link to this heading"></a></h2>
</section>
<section id="module-pymatgen.analysis.ferroelectricity.polarization">
<span id="pymatgen-analysis-ferroelectricity-polarization-module"></span><h2>pymatgen.analysis.ferroelectricity.polarization module<a class="headerlink" href="#module-pymatgen.analysis.ferroelectricity.polarization" title="Link to this heading"></a></h2>
<p>This module contains classes useful for analyzing ferroelectric candidates.
The Polarization class can recover the spontaneous polarization using
multiple calculations along a nonpolar to polar ferroelectric distortion.
The EnergyTrend class is useful for assessing the trend in energy across
the distortion.</p>
<p>See Nicola Spaldin’s “A beginner’s guide to the modern theory of polarization”
(<a class="reference external" href="https://arxiv.org/abs/1202.1831">https://arxiv.org/abs/1202.1831</a>) for an introduction to crystal polarization.</p>
<p>VASP reports dipole moment values (used to derive polarization) along Cartesian
directions (see pead.F around line 970 in the VASP source to confirm this).
However, it is most convenient to perform the adjustments necessary to recover
a same branch polarization by expressing the polarization along lattice directions.
For this reason, calc_ionic calculates ionic contributions to the polarization
along lattice directions. We provide the means to convert Cartesian direction
polarizations to lattice direction polarizations in the Polarization class.</p>
<p>We recommend using our calc_ionic function for calculating the ionic
polarization rather than the values from OUTCAR. We find that the ionic
dipole moment reported in OUTCAR differ from the naive calculation of
\sum_i Z_i r_i where i is the index of the atom, Z_i is the ZVAL from the
pseudopotential file, and r is the distance in Angstroms along the lattice vectors.
Note, this difference is not simply due to VASP using Cartesian directions and
calc_ionic using lattice direction but rather how the ionic polarization is
computed. Compare calc_ionic to VASP SUBROUTINE POINT_CHARGE_DIPOL in dipol.F in
the VASP source to see the differences. We are able to recover a smooth same
branch polarization more frequently using the naive calculation in calc_ionic
than using the ionic dipole moment reported in the OUTCAR.</p>
<p>Some definitions of terms used in the comments below:</p>
<p>A polar structure belongs to a polar space group. A polar space group has a
one of the 10 polar point group:</p>
<blockquote>
<div><p>(1, 2, m, mm2, 4, 4mm, 3, 3m, 6, 6m)</p>
</div></blockquote>
<p>Being nonpolar is not equivalent to being centrosymmetric (having inversion
symmetry). For example, any space group with point group 222 is nonpolar but
not centrosymmetric.</p>
<p>By symmetry the polarization of a nonpolar material modulo the quantum
of polarization can only be zero or 1/2. We use a nonpolar structure to help
determine the spontaneous polarization because it serves as a reference point.</p>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.EnergyTrend">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">EnergyTrend</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">energies</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L430-L474"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Analyze the trend in energy across a distortion path.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>energies</strong> – Energies.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.endpoints_minima">
<span class="sig-name descname"><span class="pre">endpoints_minima</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">slope_cutoff</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.005</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L461-L474"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.endpoints_minima" title="Link to this definition"></a></dt>
<dd><p>Test if spline endpoints are at minima for a given slope cutoff.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.max_spline_jump">
<span class="sig-name descname"><span class="pre">max_spline_jump</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L456-L459"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.max_spline_jump" title="Link to this definition"></a></dt>
<dd><p>Get maximum difference between spline and energy trend.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.smoothness">
<span class="sig-name descname"><span class="pre">smoothness</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L444-L454"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.smoothness" title="Link to this definition"></a></dt>
<dd><p>Get rms average difference between spline and energy trend.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.spline">
<span class="sig-name descname"><span class="pre">spline</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L440-L442"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.EnergyTrend.spline" title="Link to this definition"></a></dt>
<dd><p>Fit spline to energy trend data.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Polarization</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p_elecs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p_ions</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">structures</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p_elecs_in_cartesian</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p_ions_in_cartesian</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L141-L427"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Recover the same branch polarization for a set of polarization
calculations along the nonpolar - polar distortion path of a ferroelectric.</p>
<p>p_elecs, p_ions, and structures lists should be given in order
of nonpolar to polar! For example, the structures returned from:</p>
<blockquote>
<div><p>nonpolar.interpolate(polar,interpolate_lattices=True)</p>
</div></blockquote>
<p>if nonpolar is the nonpolar Structure and polar is the polar structure.</p>
<p>It is assumed that the electronic and ionic dipole moment values are given in
electron Angstroms along the three lattice directions (a,b,c).</p>
<p>p_elecs (np.ndarray): electronic contribution to the polarization with shape [N, 3]
p_ions (np.ndarray): ionic contribution to the polarization with shape [N, 3]
p_elecs_in_cartesian: whether p_elecs is along Cartesian directions (rather than lattice directions).</p>
<blockquote>
<div><p>Default is True because that is the convention for VASP.</p>
</div></blockquote>
<dl class="simple">
<dt>p_ions_in_cartesian: whether p_ions is along Cartesian directions (rather than lattice directions).</dt><dd><p>Default is False because calc_ionic (which we recommend using for calculating the ionic
contribution to the polarization) uses lattice directions.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.from_outcars_and_structures">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_outcars_and_structures</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">outcars</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">structures</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">calc_ionic_from_zval</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L186-L205"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.from_outcars_and_structures" title="Link to this definition"></a></dt>
<dd><p>Create Polarization object from list of Outcars and Structures in order
of nonpolar to polar.</p>
<p>Note, we recommend calculating the ionic dipole moment using calc_ionic
than using the values in Outcar (see module comments). To do this set
calc_ionic_from_zval = True</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.get_lattice_quanta">
<span class="sig-name descname"><span class="pre">get_lattice_quanta</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L328-L357"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_lattice_quanta" title="Link to this definition"></a></dt>
<dd><p>Get the dipole / polarization quanta along a, b, and c for
all structures.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.get_pelecs_and_pions">
<span class="sig-name descname"><span class="pre">get_pelecs_and_pions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L207-L233"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_pelecs_and_pions" title="Link to this definition"></a></dt>
<dd><p>Get the electronic and ionic dipole moments / polarizations.</p>
<dl class="simple">
<dt>convert_to_muC_per_cm2: Convert from electron * Angstroms to microCoulomb</dt><dd><p>per centimeter**2</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.get_polarization_change">
<span class="sig-name descname"><span class="pre">get_polarization_change</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L359-L366"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_polarization_change" title="Link to this definition"></a></dt>
<dd><p>Get difference between nonpolar and polar same branch polarization.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.get_polarization_change_norm">
<span class="sig-name descname"><span class="pre">get_polarization_change_norm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L368-L378"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_polarization_change_norm" title="Link to this definition"></a></dt>
<dd><p>Get magnitude of difference between nonpolar and polar same branch
polarization.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.get_same_branch_polarization_data">
<span class="sig-name descname"><span class="pre">get_same_branch_polarization_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L235-L326"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.get_same_branch_polarization_data" title="Link to this definition"></a></dt>
<dd><p>Get same branch dipole moment (convert_to_muC_per_cm2=False)
or polarization for given polarization data (convert_to_muC_per_cm2=True).</p>
<p>Polarization is a lattice vector, meaning it is only defined modulo the
quantum of polarization:</p>
<blockquote>
<div><p>P = P_0 + \sum_i \frac{n_i e R_i}{\Omega}</p>
</div></blockquote>
<p>where n_i is an integer, e is the charge of the electron in microCoulombs,
R_i is a lattice vector, and \Omega is the unit cell volume in cm**3
(giving polarization units of microCoulomb per centimeter**2).</p>
<p>The quantum of the dipole moment in electron Angstroms (as given by VASP) is:</p>
<blockquote>
<div><p>\sum_i n_i e R_i</p>
</div></blockquote>
<p>where e, the electron charge, is 1 and R_i is a lattice vector, and n_i is an integer.</p>
<p>Given N polarization calculations in order from nonpolar to polar, this algorithm
minimizes the distance between adjacent polarization images. To do this, it
constructs a polarization lattice for each polarization calculation using the
pymatgen.core.structure class and calls the get_nearest_site method to find the
image of a given polarization lattice vector that is closest to the previous polarization
lattice vector image.</p>
<p>Note, using convert_to_muC_per_cm2=True and all_in_polar=True calculates the “proper
polarization” (meaning the change in polarization does not depend on the choice of
polarization branch) while convert_to_muC_per_cm2=True and all_in_polar=False calculates
the “improper polarization” (meaning the change in polarization does depend on the choice
of branch). As one might guess from the names. We recommend calculating the “proper
polarization”.</p>
<dl class="simple">
<dt>convert_to_muC_per_cm2: convert polarization from electron * Angstroms to</dt><dd><p>microCoulomb per centimeter**2</p>
</dd>
</dl>
<p>all_in_polar: convert polarization to be in polar (final structure) polarization lattice</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.max_spline_jumps">
<span class="sig-name descname"><span class="pre">max_spline_jumps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L402-L412"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.max_spline_jumps" title="Link to this definition"></a></dt>
<dd><p>Get maximum difference between spline and same branch polarization data.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.same_branch_splines">
<span class="sig-name descname"><span class="pre">same_branch_splines</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L380-L400"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.same_branch_splines" title="Link to this definition"></a></dt>
<dd><p>Fit splines to same branch polarization. This is used to assess any jumps
in the same branch polarization.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.Polarization.smoothness">
<span class="sig-name descname"><span class="pre">smoothness</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">convert_to_muC_per_cm2</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">all_in_polar</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L414-L427"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.Polarization.smoothness" title="Link to this definition"></a></dt>
<dd><p>Get rms average difference between spline and same branch polarization data.</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.calc_ionic">
<span class="sig-name descname"><span class="pre">calc_ionic</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">site</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.sites.PeriodicSite" title="pymatgen.core.sites.PeriodicSite"><span class="pre">PeriodicSite</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">structure</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">zval</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">np.ndarray</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L84-L95"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.calc_ionic" title="Link to this definition"></a></dt>
<dd><p>Calculate the ionic dipole moment using ZVAL from pseudopotential.</p>
<p>site: PeriodicSite
structure: Structure
zval: Charge value for ion (ZVAL for VASP pseudopotential)</p>
<p>Returns polarization in electron Angstroms.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.get_nearest_site">
<span class="sig-name descname"><span class="pre">get_nearest_site</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">struct</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">coords</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.sites.PeriodicSite" title="pymatgen.core.sites.PeriodicSite"><span class="pre">PeriodicSite</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">r</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L113-L138"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.get_nearest_site" title="Link to this definition"></a></dt>
<dd><p>Given coords and a site, find closet site to coords.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>coords</strong> (<em>3x1 array</em>) – Cartesian coords of center of sphere</p></li>
<li><p><strong>site</strong> – site to find closest to coords</p></li>
<li><p><strong>r</strong> (<em>float</em>) – radius of sphere. Defaults to diagonal of unit cell</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Closest site and distance.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.get_total_ionic_dipole">
<span class="sig-name descname"><span class="pre">get_total_ionic_dipole</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">structure</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">zval_dict</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L98-L110"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.get_total_ionic_dipole" title="Link to this definition"></a></dt>
<dd><p>Get the total ionic dipole moment for a structure.</p>
<p>structure: pymatgen Structure
zval_dict: specie, zval dictionary pairs
center (np.array with shape [3,1]) : dipole center used by VASP
tiny (float) : tolerance for determining boundary of calculation.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.analysis.ferroelectricity.polarization.zval_dict_from_potcar">
<span class="sig-name descname"><span class="pre">zval_dict_from_potcar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">potcar</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../analysis/ferroelectricity/polarization.py#L75-L81"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.analysis.ferroelectricity.polarization.zval_dict_from_potcar" title="Link to this definition"></a></dt>
<dd><p>Create zval_dictionary for calculating the ionic polarization from
Potcar object.</p>
<p>potcar: Potcar object</p>
</dd></dl>

</section>
</section>


           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2011, Pymatgen Development Team.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>
